import { get, post, download } from '../../../config/axios'
import { IResponse } from '../../../config/axios/type'
import { findData } from '../../store/dailyStore/types'

enum DAILY_URL {
  LISTALL = '/dailyTest/listAll',
  ADDEXAMRECORD = '/dailyTest/updateExamRecord',
  LISTRECORDS = '/dailyTest/listExamRecords',
  EXPORTRECORDS = '/dailyTest/export'
}

export default {
  listAll: async (data: findData, id: any) =>
    post<IResponse>({
      url: DAILY_URL.LISTALL + '/' + data.subjectId + '/' + data.level + '/' + id
    }),
  addExamRecord: async (data: any) => post<IResponse>({ url: DAILY_URL.ADDEXAMRECORD, data }),
  listRecords: async (data: String) =>
    post<IResponse>({
      url: DAILY_URL.LISTRECORDS,
      data
    }),
  exportExamRecord: async (data: string) =>
    download({ url: DAILY_URL.EXPORTRECORDS + '?realName=' + JSON.stringify(data) })
}
